package com.liwujie.dto;



import com.liwujie.car.dto.ShopCartItemDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;


import javax.validation.constraints.AssertFalse;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

@Data
@ApiModel(value = "订单提交参数")
public class OrderDTO {

    @NotNull(message = "地址不能为空")
    @ApiModelProperty(value = "地址ID", required = true)
    private Long orderAddrId;

    @NotNull(message = "配送方式不能为空")
    @ApiModelProperty(value = "配送方式 1:快递 2:自提", required = true)
    private Integer deliveryType;

    @ApiModelProperty(value = "支付方式 1:微信 2:支付宝 3:余额支付", required = true)
    private Integer paymentType;

    @ApiModelProperty(value = "期望配送时间")
    private Date expectDeliveryTime;

    @ApiModelProperty(value = "订单备注")
    private String remarks;

    @ApiModelProperty(value = "购物车ID集合")
    private List<Long> shopCartIds;

    @ApiModelProperty(value = "立即购买时提交的商品项,如果该值为空，则说明是从购物车进入，如果该值不为空则说明为立即购买")
    private ShopCartItemDTO shopCartItemDTO;
    @AssertFalse(message = "购物车和直接购买不能同时提交")
    public boolean isConflict() {
        return shopCartIds != null && shopCartItemDTO != null;
    }

}